package com.mayn.jst.shop.action;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.plugin.activerecord.Db;
import com.mayn.jst.shop.model.ShopModel;

/**
 * ShopAccount处理类
 * 
 * @author Administrator
 *
 */
public class ShopAction {
	private static final Logger LOG = LoggerFactory.getLogger(ShopAction.class);

	/**
	 * 查询指定店铺记录
	 * 
	 * @param shopId
	 * @return
	 */
	public static ShopModel getShop(int shopId) {
		try {
			String sql = "SELECT * FROM shop WHERE SHOP_ID=?";
			return ShopModel.dao.findFirst(sql, shopId);
		} catch (Exception e) {
			LOG.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " Exception,Msg=" + e.getMessage());
		}
		return null;
	}

	public static int getShopType(int shopId) {
		try {
			String sql = "SELECT SHOP_TYPE FROM shop WHERE SHOP_ID=?";
			return Db.queryInt(sql, shopId);
		} catch (Exception e) {
			LOG.error(Thread.currentThread().getStackTrace()[1].getMethodName() + " Exception,Msg=" + e.getMessage());
		}
		return 0;
	}

}
